<template>
	<view>
		<basics v-if="PageCur=='basics'"></basics>
		<about v-if="PageCur=='about'"></about>
		<view class="cu-bar tabbar bg-white shadow foot">
			<view class="action" @click="NavChange" data-cur="basics">
				<view class='cuIcon-cu-image'>
					<image :src="'/static/tabbar/basics' + [PageCur=='basics'?'_cur':''] + '.png'"></image>
				</view>
				<view :class="PageCur=='basics'?'text-green':'text-gray'">首页</view>
			</view>
			<view class="action" @click="NavChange" data-cur="about">
				<view class='cuIcon-cu-image'>
					<image :src="'/static/tabbar/about' + [PageCur == 'about'?'_cur':''] + '.png'"></image>
				</view>
				<view :class="PageCur=='about'?'text-green':'text-gray'">我的</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {mapState} from 'vuex'
	export default {
		data() {
		return {
				PageCur: 'basics'
			}
		},
		computed:{
			...mapState(['userinfo'])
		},
		onShow() {
			if(Object.keys(this.userinfo).length <= 0) {
				this.PageCur = 'about'
				uni.showToast({
					title: '请先登陆'
				})
			}
		},
		methods: {
			NavChange: function(e) {
				if(Object.keys(this.userinfo).length <= 0) {
					this.PageCur = 'about'
					uni.showToast({
						title: '请先登陆'
					})
					return
				}
				this.PageCur = e.currentTarget.dataset.cur
			}
		}
	}
</script>

<style>

</style>
